﻿Public Class frmThemPhieuXuat
    Dim px As CPhieuXuat
    Dim mh As CMatHang
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        px = New CPhieuXuat
        px.MaNhanVien = txtMaNV.Text
        px.NgayXuat = dtpNgayXuat.Text
        mh = New CMatHang
        Try
            Dim index As Integer = dgvCTPhieuXuat.Rows.Count - 2
            Dim da As DataProvider
            For i As Integer = index To 0 Step -1
                da = New DataProvider
                mh.MaMH = dgvCTPhieuXuat.Rows(i).Cells(0).Value.ToString()
                mh.TenMH = dgvCTPhieuXuat.Rows(i).Cells(1).Value.ToString()
                mh.Loai = dgvCTPhieuXuat.Rows(i).Cells(2).Value.ToString()
                mh.Gia = dgvCTPhieuXuat.Rows(i).Cells(3).Value.ToString()
                mh.XuatXu = dgvCTPhieuXuat.Rows(i).Cells(4).Value.ToString()
                mh.DonVi = dgvCTPhieuXuat.Rows(i).Cells(5).Value.ToString()
                mh.SoLuong = dgvCTPhieuXuat.Rows(i).Cells(6).Value.ToString()
                CPhieuXuat.Insert(px, mh)
                
            Next
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.MsgBoxHelp, "Error")
        End Try
    End Sub

    Private Sub btnChon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChon.Click
        Dim frm As New frmChonMatHangXuat
        frm.Show()
        'frm.MdiParent = frmMain
    End Sub

    Private Sub frmThemPhieuXuat_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Me.WindowState = FormWindowState.Maximized
    End Sub
End Class